Skip to content

feat: implement asset refresh scheduling for playlists - #499

Merged
francoism90 merged 3 commits into
mainfrom
fix/manifest-expire
Aug 6, 2026
Merged

feat: implement asset refresh scheduling for playlists#499
francoism90 merged 3 commits into
mainfrom
fix/manifest-expire

Conversation

@francoism90

Copy link
Copy Markdown
Owner

This pull request refactors how playlist manifest URL refreshes are handled, moving the refresh logic from the backend to the frontend. The player now schedules a manifest refetch before the signed URL expires, ensuring uninterrupted playback without relying on backend event listeners or actions. Several backend files and tests related to the old refresh mechanism are removed, and new frontend logic and tests are added to handle the refresh process.

Frontend: Manifest Refresh Scheduling

  • Added scheduleAssetRefresh and cancelAssetRefresh to usePlaylist, which schedule and cancel a timer to reload the playlist before the manifest URL expires. The timer uses the new asset_refresh_in property from the backend. (resources/js/composables/playlist.ts, resources/js/composables/playlist.tsR2-R22)
  • Updated useShaka to call scheduleAssetRefresh when loading a playlist and cancelAssetRefresh on reset, ensuring the manifest is refreshed at the correct time during playback. (resources/js/composables/shaka.ts, [1] [2] [3] [4]
  • Added comprehensive tests for the new refresh logic, including timer scheduling, cancellation, and ensuring reloads occur as expected. (resources/js/__tests__/composables/playlist.test.ts, [1] [2]

Backend: Supporting Data and Cleanup

  • Added getUrlRefreshIn to the Playlist model and exposed it as asset_refresh_in in the API resource, providing the frontend with the correct refresh interval. (src/Domain/Playlists/Models/Playlist.php, [1]; src/App/Api/Playlists/Resources/PlaylistResource.php, [2]
  • Removed the backend manifest refresh action, event listener, and related feature tests, as this logic is now handled on the frontend. (src/Domain/Playlists/Actions/RefreshPlaylistManifest.php, [1]; src/Domain/Playlists/Listeners/RefreshExpiringPlaylistManifest.php, [2]; tests/Feature/Playlist/RefreshPlaylistManifestTest.php, [3]; tests/Feature/Playlist/RefreshExpiringPlaylistManifestTest.php, [4]

Configuration and Documentation

  • Updated the manifest refresh configuration comment for clarity, reflecting the new frontend-based approach. (config/playlists.php, config/playlists.phpL83-R85)

Testing

These changes simplify the manifest refresh flow, reduce backend complexity, and ensure the player always has a valid manifest URL for uninterrupted playback.

@francoism90
francoism90 merged commit cdf6419 into main Aug 6, 2026
3 checks passed
@francoism90
francoism90 deleted the fix/manifest-expire branch August 6, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant